﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/masAdmin.master" AutoEventWireup="true"
    CodeFile="EntryList.aspx.cs" Inherits="admin_EntryList" %>

<%@ Register Assembly="CommonTagTime" Namespace="CommonTagTime.PagerControl" TagPrefix="cc1" %>
<%@ Import Namespace="CommonTagTime" %>
<asp:Content ID="Content4" ContentPlaceHolderID="pagename" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="content" runat="Server">
    <div class="content-box-header">
        <h3>
            Thông tin mã thiết kế</h3>
    </div>
    <div class="content-box-content">
        <div id="tab1">
            <table class="table100">
                <tr>
                    <td style="width: 100px;" align="right">
                        Mã thiết kế:
                    </td>
                    <td style="width: 100px;">
                        <asp:TextBox ID="txtDesignCode" Enabled="false" runat="server" Width="90px"></asp:TextBox>
                    </td>
                    <td style="width: 120px;" align="right">
                        Số lượng yêu cầu:
                    </td>
                    <td style="width: 70px;">
                        <asp:TextBox ID="txtRequestQuantity" Enabled="false" Style="text-align: right;" runat="server"
                            Width="60px"></asp:TextBox>
                    </td>
                    <td style="width: 120px;" align="right">
                        Đã thực hiện:
                    </td>
                    <td style="width: 70px;">
                        <asp:TextBox ID="txtQuantityFinish" Enabled="false" Style="text-align: right;" runat="server"
                            Width="60px"></asp:TextBox>
                    </td>
                    <td style="width: 80px;" align="right">
                        Còn lại:
                    </td>
                    <td style="width: 70px;">
                        <asp:TextBox ID="txtQuantity" Enabled="false" Style="text-align: right;" runat="server"
                            Width="60px"></asp:TextBox>
                    </td>
                    <td align="left">
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="divGrid" class="box" runat="server">
        <div class="pagination right">
            <cc1:Pager ID="Pager2" runat="server" OnPageIndexChanging="Pager2_PageIndexChanging"
                OnPageSizeChanging="Pager2_PageSizeChanging" />
        </div>
        <div>
            <asp:Button ID="btnDelete" Text="Delete" runat="server" CssClass="button" OnClientClick="return CheckDelete();"
                OnClick="btnDelete_Click" />
            <asp:Button ID="btnAddNew" Text="Add New" runat="server" CssClass="button" OnClick="btnAddNew_Click" />
             <asp:Button ID="btnCancel" Text="Back" runat="server" CssClass="button" OnClick="btnCancel_Click" />
        </div>
        <asp:Repeater ID="rptData" runat="server" OnItemCommand="rptData_ItemCommand" OnItemDataBound="rptData_ItemDataBound">
            <HeaderTemplate>
                <table class="table100" border="0">
                    <thead>
                        <th class="gridCheckBoxColumHeader">
                            <input id="chkCheckAll" type="checkbox" onclick="CheckAll(this.checked)" />
                        </th>
                        <th class="gridNoColumHeader">
                            No.
                        </th>
                        <th class="align-left" style="width: 170px;">
                            <asp:LinkButton ID="lbtnProducedDate" runat="server" Text="Ngày sản xuất" CommandName="SortOrder"
                                CommandArgument="ProducedDate">
                            </asp:LinkButton>
                        </th>
                        <th class="align-left">
                            <asp:LinkButton ID="lbtnProducedId" runat="server" Text="Nhân viên sản xuất" CommandName="SortOrder"
                                CommandArgument="ProducerId">
                            </asp:LinkButton>
                        </th>
                        <th class="align-left" style="width: 170px;">
                            <asp:LinkButton ID="lbtnShift" runat="server" Text="Ca" CommandName="SortOrder" CommandArgument="ShiftId">
                            </asp:LinkButton>
                        </th>
                        <th class="align-left">
                            <asp:LinkButton ID="lbtnQuantity" runat="server" Text="Số lượng thực hiện" CommandName="SortOrder"
                                CommandArgument="Quantity">
                            </asp:LinkButton>
                        </th>
                        <th class="align-left">
                            <asp:LinkButton ID="lbtnLocation" runat="server" Text="Bộ phận" CommandName="SortOrder"
                                CommandArgument="LocationId">
                            </asp:LinkButton>
                        </th>
                        <th class="griActionColumHeader">
                            Action
                        </th>
                    </thead>
            </HeaderTemplate>
            <ItemTemplate>
                <tr id="trRow" runat="server">
                    <td align="center">
                        <input type="checkbox" name="chk_<%#Eval("EntryId") %>" id="chk_<%#Eval("EntryId") %>"
                            onclick="CheckItem('<%#Eval("EntryId") %>',this.checked);" />
                    </td>
                    <td align="center">
                        <%#Container.ItemIndex + 1%>
                    </td>
                    <td align="left">
                        <asp:Literal ID="ltrProducedDate" runat="server"></asp:Literal>
                    </td>
                    <td>
                        <asp:Literal ID="ltrProduced" runat="server"></asp:Literal>
                    </td>
                    <td>
                        <asp:Literal ID="ltrShift" runat="server"></asp:Literal>
                    </td>
                    <td>
                        <asp:Literal ID="ltrQuantity" runat="server"></asp:Literal>
                    </td>
                    <td>
                        <asp:Literal ID="ltrLocation" runat="server"></asp:Literal>
                    </td>
                    <td align="center">
                        <a href="EntryAdd.aspx?OrderDetailId=<%=OrderDetailId%>&EntryId=<%#Eval("EntryId") %>&LocationId=<%=LocationId%>&<%=paraURL%>">
                            <img src="/App_Themes/Admin/images/icons/pencil.png" alt="Edit" title="Edit" />
                        </a>
                        <asp:ImageButton ID="imbDelete" runat="server" ImageUrl="~/App_Themes/Admin/images/cross_circle.png"
                            CommandName="Delete" />
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        <div class="pagination">
            <cc1:Pager ID="Pager1" runat="server" OnPageIndexChanging="Pager2_PageIndexChanging"
                OnPageSizeChanging="Pager2_PageSizeChanging" />
        </div>
    </div>
    <input type="hidden" value="" runat="server" id="hidID" />
    <input type="hidden" value="" runat="server" id="hidIDSelect" />
    <br />
    <div id="divEmplty" runat="server" visible="false">
       
    </div>
      <br />
     <br />
     <table>
        <tr>
        <td style="width:80px">
        <asp:Button ID="btnAddNew1" Text="Add New" runat="server" CssClass="button" OnClick="btnAddNew_Click" />
        </td>
        <td>
        <asp:Button ID="btnCancel1" Text="Back" runat="server" CssClass="button" OnClick="btnCancel1_Click" />
        </td>
        </tr>
     </table>
     
   
    <!-- End .content-box-content -->
    <script type="text/javascript">

        function CheckAll(status) {
            var id = document.getElementById('<%=hidID.ClientID %>').value;
            var arr = new Array();
            arr = id.split(';');
            if (arr.length > 0) {
                for (var i = 0; i < arr.length; i++) {
                    if (document.getElementById('chk_' + arr[i].toString())) {
                        document.getElementById('chk_' + arr[i].toString()).checked = status;

                    }
                }

            }
            if (status) {
                document.getElementById('<%=hidIDSelect.ClientID %>').value = id;
            }
            else document.getElementById('<%=hidIDSelect.ClientID %>').value = '';

        }
        function CheckItem(id, status) {

            var idSelect = document.getElementById('<%=hidIDSelect.ClientID %>').value;
            if (status) {
                idSelect += id + ';';
            }
            else idSelect = idSelect.replace(id + ';', '');
            if (idSelect.length == document.getElementById('<%=hidID.ClientID %>').value.length) {
                document.getElementById('chkCheckAll').checked = true;
            }
            else
                document.getElementById('chkCheckAll').checked = false;
            document.getElementById('<%=hidIDSelect.ClientID %>').value = idSelect;

        }
        function ConfirmDelete() {
            var yes = confirm('<%=Resources.Resource.MSG_CONFIRM_DELETE %>');
            return yes;
        }
        function CheckDelete() {

            var id = document.getElementById('<%=hidIDSelect.ClientID %>').value;
            if (id == '') {
                alert('<%=Resources.Resource.MSG_REQUIRE_SELECT_ITEM %>');
                return false;
            }
            else return ConfirmDelete();
        }
    </script>
</asp:Content>
